﻿using UnityEngine;
using System.Collections;

public class PuzzleScript : MonoBehaviour {

	public Material highlight;
	public Vector3 fallOrder = new Vector3(1, 2, 3);


	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	public int getFirstDirection(){
		if (fallOrder.x < fallOrder.y && fallOrder.x < fallOrder.z) {
			return 1;
		}else if (fallOrder.y < fallOrder.x && fallOrder.y < fallOrder.z) {
			return 2;
		}else if (fallOrder.z < fallOrder.y && fallOrder.z < fallOrder.x) {
			return 3;
		}
		return -1;
	}

	public int getSecondDirection(){
		if ((fallOrder.x < fallOrder.y && fallOrder.x > fallOrder.z) || (fallOrder.x < fallOrder.z && fallOrder.x > fallOrder.y)) {
			return 1;
		}else if ((fallOrder.y < fallOrder.x && fallOrder.y > fallOrder.z) || (fallOrder.y < fallOrder.z && fallOrder.y > fallOrder.x)) {
			return 2;
		}else if ((fallOrder.z < fallOrder.y && fallOrder.z > fallOrder.x) || (fallOrder.z < fallOrder.x && fallOrder.z > fallOrder.y)) {
			return 3;
		}
		return -1;
	}

	public int getThirdDirection(){
		if (fallOrder.x > fallOrder.y && fallOrder.x > fallOrder.z) {
			return 1;
		}else if (fallOrder.y > fallOrder.x && fallOrder.y > fallOrder.z) {
			return 2;
		}else if (fallOrder.z > fallOrder.y && fallOrder.z > fallOrder.x) {
			return 3;
		}
		return -1;
	}
}
